package cn.libiting.dateRange.utils;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: wangxc
 * Date: 12-9-24
 * Time: 下午5:07
 * To change this template use File | Settings | File Templates.
 */
public class ThreadLocalUtil {
    private static final ThreadLocal<Date> dateThreadLocal = new ThreadLocal();

    public static void setDateInto(Date date) {
        if (date == null) {
            date = new Date();
        }
        dateThreadLocal.set(date);
    }

    public static void setDateInto() {
        setDateInto(null);
    }

    public static Date getDateFrom() {
        return dateThreadLocal.get();
    }
}
